<!DOCTYPE html>

<html xmlns:th="https://www.thymeleaf.org"
  th:replace="~{fragments/layout :: layout (~{::body},'owners')}">

  <body>
  
  
    <h2>拥有者个人信息</h2>
  
  
    <table class="table table-striped" th:object="${owner}">
      <tr>
        <th>名字</th>
        <td><b th:text="*{firstName + ' ' + lastName}"></b></td>
      </tr>
      <tr>
        <th>详细地址</th>
        <td th:text="*{address}"></td>
      </tr>
      <tr>
        <th>城市</th>
        <td th:text="*{city}"></td>
      </tr>
      <tr>
        <th>电话</th>
        <td th:text="*{telephone}"></td>
      </tr>
    </table>
  
    <a th:href="@{{id}/edit(id=${owner.id})}" class="btn btn-default">修改该人信息</a>
    <a th:href="@{{id}/pets/new(id=${owner.id})}" class="btn btn-default">添加该人拥有的宠物</a>
  
    <br />
    <br />
    <br />
    <h2>拥有的宠物和探望记录</h2>
  
    <table class="table table-striped">
  
      <tr th:each="pet : ${owner.pets}">
        <td valign="top">
          <dl class="dl-horizontal">
            <dt>宠物名字</dt>
            <dd th:text="${pet.name}"></dd>
            <dt>宠物生日</dt>
            <dd
              th:text="${#temporals.format(pet.birthDate, 'yyyy-MM-dd')}"></dd>
            <dt>宠物种类</dt>
            <dd th:text="${pet.type}"></dd>
          </dl>
        </td>
        <td valign="top">
          <table class="table-condensed">
            <thead>
              <tr>
                <th>探望日期</th>
                <th>探望记录详情</th>
              </tr>
            </thead>
            <tr th:each="visit : ${pet.visits}">
              <td th:text="${#temporals.format(visit.date, 'yyyy-MM-dd')}"></td>
              <td th:text="${visit?.description}"></td>
            </tr>
            <tr>
              <td><a
                th:href="@{{ownerId}/pets/{petId}/edit(ownerId=${owner.id},petId=${pet.id})}">修改该人探望日期</a></td>
              <td><a
                th:href="@{{ownerId}/pets/{petId}/visits/new(ownerId=${owner.id},petId=${pet.id})}">添加该人的探望记录</a></td>
            </tr>
          </table>
        </td>
      </tr>
  
    </table>
  
  </body>

</html>
